package uutalk.netcloud.talk.app.ui.adapter;

import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import uutalk.netcloud.talk.R;
import uutalk.netcloud.talk.base.util.thirdpart.EventMamager;
import uutalk.netcloud.talk.model.bean.GroupInfoBean;
import uutalk.netcloud.talk.model.bean.SimpleEventType;

/**
 * Created by hujie on 2017/9/9.
 */

public class JoinedGroupsAdapter extends BaseQuickAdapter<GroupInfoBean, BaseViewHolder> {


    public JoinedGroupsAdapter(@Nullable List<GroupInfoBean> data) {
        super(R.layout.group_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GroupInfoBean item) {
        helper.setText(R.id.content, item.getGroup_name().trim());
        helper.getView(R.id.content).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                EventMamager.getInstance().postIntEvent(SimpleEventType.ON_JOINED_GROUP_CLICK, helper.getLayoutPosition());

            }
        });

        helper.getView(R.id.btnDelete).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                EventMamager.getInstance().postIntEvent(SimpleEventType.ON_JOINED_GROUP_DELETE_CLICK, helper.getLayoutPosition());

            }
        });
    }

}
